﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Convert_DVR_MS_to_iTunes
{
    public enum ProcessingStatus
    {
        NotProcessed = 1,
        Processing = 2,
        CompleteOK = 3,
        CompleteFailed = 4
    }

    public class FilesForProcessing
    {
        private List<FileForProcessing> colFilesForProcessing = new List<FileForProcessing>();

        public void Add(FileForProcessing file)
        {
            colFilesForProcessing.Add(file);
        }

        public int Count
        {
            get
            {
                return colFilesForProcessing.Count;
            }
        }

        public FileForProcessing Item(int i)
        {
            return colFilesForProcessing[i];
        }

        public void Clear()
        {
            colFilesForProcessing.Clear();
        }

        public MyFileForProcessingEnumerator GetEnumerator()
        {
            return new MyFileForProcessingEnumerator(this);
        }
    }

    public class FileForProcessing
    {
        public ProcessingStatus Status = ProcessingStatus.NotProcessed;
        public string SourcePathFile;

        public string TVShowName;

        public StringBuilder MessageLog;
    }

    // Enumerator class
    public class MyFileForProcessingEnumerator
    {
        int nIndex;
        FilesForProcessing collection;

        public MyFileForProcessingEnumerator(FilesForProcessing coll)
        {
            collection = coll;
            nIndex = -1;
        }

        public bool MoveNext()
        {
            nIndex++;
            return (nIndex < collection.Count);
        }

        public FileForProcessing Current
        {
            get
            {
                return (collection.Item(nIndex));
            }
        }
    }
}
